package pt.um.jspecput.lib.writer;

import static pt.um.jspecput.util.Constants.*;

import java.io.IOException;
import java.io.Writer;

/**
 * The Class JavaClassWriter.
 */
public abstract class TestClassWriterHelper extends ClassWriterHelper {

    /**
     * Opens a public test class declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param className
     *            the name of the class
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openPublicClassDeclaration(Writer writer,
            String className) throws IOException {
        writer.write(TEST_RUNNER);
        ClassWriterHelper.openPublicClassDeclaration(writer, className);
    }

    /**
     * Opens a public test abstract class declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param className
     *            the name of the class
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openPublicAbstractClassDeclaration(Writer writer,
            String className) throws IOException {
        writer.write(TEST_RUNNER);
        ClassWriterHelper.openPublicAbstractClassDeclaration(writer, className);
    }

    /**
     * Opens a public test final class declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param className
     *            the name of the class
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openPublicFinalClassDeclaration(Writer writer,
            String className) throws IOException {
        writer.write(TEST_RUNNER);
        ClassWriterHelper.openPublicFinalClassDeclaration(writer, className);
    }

    /**
     * Opens a test class declaration without any access level.
     * 
     * @param writer
     *            the writer for the file
     * @param className
     *            the name of the class
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openClassDeclaration(Writer writer, String className)
            throws IOException {
        writer.write(TEST_RUNNER);
        ClassWriterHelper.openClassDeclaration(writer, className);
    }

    /**
     * Opens an abstract test class declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param className
     *            the name of the class
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openAbstractClassDeclaration(Writer writer,
            String className) throws IOException {
        writer.write(TEST_RUNNER);
        ClassWriterHelper.openAbstractClassDeclaration(writer, className);
    }

    /**
     * Opens a final test class declaration.
     * 
     * @param writer
     *            the writer for the file
     * @param className
     *            the name of the class
     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    public static void openFinalClassDeclaration(Writer writer, String className)
            throws IOException {
        writer.write(TEST_RUNNER);
        ClassWriterHelper.openFinalClassDeclaration(writer, className);
    }
}